-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement animated features demo component #4
feat: implement animated features demo component #4
Conversation
✅ Successfully deployed static |
510d100
to
dce60cc
Compare
dce60cc
to
c5fb5bb
Compare
c5fb5bb
to
6bedb07
Compare
6bedb07
to
d190b0f
Compare
d190b0f
to
d1dca74
Compare
d1dca74
to
2570bfe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
}, | ||
{ | ||
id: ConsoleId.SendInputSearch, | ||
messages: ["`<br>> browser.$(\"input[data-data-id='search']\");`"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А что это за сложный селектор такой? Почему просто класс не использовать?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Там должен быть data-role-id
, ошибка. Как мне кажется тут уместно использовать data-атрибуты, потому что нам не нужны CSS-селекторы и мы не хотим привязываться ко стилям. Мы хотим достать "input, который для поиска товаров", надежнее всего под это выделить data-атрибут и искать потом по нему, как мне кажется.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.input_type_search
решает эту проблему ;)
как минимум, читается это проще
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вроде бы использование конкретных testid'ов в тестах же является common-, если не best-practice. Я вижу такие преимущества использования разметки data-testid над селекторами:
- все data-testid можно вырезать при сборке бандла в прод, а селекторы нет
- селекторы относятся к стилям, если захочется рефакторить стили, поменяются селекторы и все тесты надо будет тоже чинить
Пока что просто поправил на data-testid
.
@@ -43,25 +70,16 @@ const config: StorybookConfig = { | |||
rules: [ | |||
...(config.module?.rules as Record<string, any>[]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where can I view these rules? can't find them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we extend storybook's webpack config with some custom rules. By adding ...config.module.rules
we make sure to include original rules, we don't want to throw them away when adding ours.
Docs: https://storybook.js.org/docs/api/main-config-webpack-final
rules: _.omit(geminiTesting.rules, [ | ||
// Rules that conflict with typescript-eslint. | ||
"no-undef", | ||
"no-unused-vars", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to exclude this rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it conflicts with typescript-eslint, as stated in the comment above. It provides its own rule, @typescript-eslint/no-unusd-vars
, because the original one doesn't work well with TS code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jpg? really? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with jpg? I'm trying to squeeze assets as tightly as I can so that landing page opens up fast enough even on slow internet. Pics are not of great quality, but good enough for demo purposes, IMO
src/components/Collapsible/index.tsx
Outdated
|
||
export function Collapsible(props: CollapsibleProps) { | ||
return ( | ||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for better code readability we need to add selectors (for example, .collapsible
) instead of leaving empty elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, added unused collapsible
class for the sake of better devtools experience and corresponding class names for other components as well. I still think that it kinda diminishes some of the benefits of using Tailwind though
}, | ||
{ | ||
id: ConsoleId.SendInputSearch, | ||
messages: ["`<br>> browser.$(\"input[data-data-id='search']\");`"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.input_type_search
решает эту проблему ;)
как минимум, читается это проще
ref={codeElementRef} | ||
> | ||
<div | ||
className="absolute text-right text-blue-400 opacity-40" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolute
... again... instead of simple display: inline-block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, I don't want line numbers to affect code in any way and don't want to deal with inline blocks wrapping/overflowing/etc, that's why I positioned them absolutely. What's the benefit of using inline-block here?
const controller = new AbortController(); | ||
const signal = controller.signal; | ||
|
||
const steps: (() => void | Promise<void>)[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imho, it would be better to move stept to the separate file(files) for more readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this thought has crossed my mind, however A LOT of things (many refs, signals, store data, etc.) are used inside steps (via closures), if we move them outside, we'll severely worsen readability in that aspect, so in the end I've decided against it.
Otherwise we'll need to construct a function which takes 20+ params (even if packed into an object) and write corresponding types for them all.
Do you think it's worth it?
src/components/FeaturesDemo/utils.ts
Outdated
containerRef: RefObject<HTMLDivElement>, | ||
) => { | ||
const offsetTop = | ||
lineRef.current!.offsetTop - containerRef.current!.parentElement!.clientHeight + 80; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
80?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a comment. It's just an arbitrary value, to add some room underneath the line, was chosen by trial and error.
…nts and AssertViewResult component
What's done?
This PR implements the animated features demo component. Feel free to explore how it looks on different screen sizes in storybook.
Notes:
How to review?
Consider using Github Codespaces for easier navigation.
src/components/FeaturesDemo/index.tsx
is a main file describing the whole demo timeline, it's a good place to start.